package com.content.service.fallback;

import com.content.service.feignclient.SearchServiceClient;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class SearchServiceClientFallbackFactory implements FallbackFactory<SearchServiceClient> {
    @Override
    public SearchServiceClient create(Throwable throwable) {
        return courseIndex -> {
            //降级方法
            log.debug("调用搜索服务发布课程时发生熔断，异常信息:{}", throwable.toString(), throwable);
            return false;
        };
    }
}
